---
title: Integrate Nx with your Coding Assistant
description: Set up Nx MCP server to give AI assistants deep workspace context, terminal integration, and enhanced development capabilities.
sidebar:
  order: 6
  label: AI Integration
filter: 'type:Features'
---

Nx provides deep integration with AI coding assistants through the **Nx Model Context Protocol (MCP) server**, giving your AI assistant comprehensive understanding of your monorepo structure, running processes, and development workflows. When you create a new Nx workspace, it includes AI agent configuration files (`CLAUDE.md` and `AGENTS.md`) that provide guidelines for working with Nx and the Nx MCP server.

## Configure Nx AI Integration

{% youtube
src="https://youtu.be/8gdvIz2r_QM"
title="Set Up AI Agents in Nx"
/%}

### Automatic AI Setup

To automatically configure your Nx workspace to work best with AI agents and assistants, run the following command:

```shell
npx nx configure-ai-agents
```

This will prompt you for which AI agents/assistants to configure and make sure you are properly set up with both the [Nx MCP](/docs/features/enhance-ai) as well as corresponding AI agent configuration files (e.g. `AGENTS.md`, `CLAUDE.md` etc).

Watch [our Youtube video](https://youtu.be/8gdvIz2r_QM) for a full walkthrough.

### Manual AI Setup

You can of course manually configure the Nx MCP for MCP-compatible clients using the following configuration:

```json
// mcp.json
{
  "servers": {
    "nx-mcp": {
      "command": "npx",
      "args": ["nx-mcp@latest"]
    }
  }
}
```

For Claude Code:

```shell
claude mcp add nx-mcp npx nx-mcp@latest
```

### What This Integration Enables

The Nx AI integration provides your coding assistant with powerful capabilities:

- **[Workspace Structure Understanding](https://nx.dev/blog/nx-mcp-vscode-copilot)** - Deep architectural awareness of your monorepo, project relationships, and dependencies
- **[Real-time Terminal Integration](https://nx.dev/blog/nx-terminal-integration-ai)** - AI can read your terminal output, running processes, and error messages without copy-pasting
- **[CI Pipeline Context](https://nx.dev/blog/nx-editor-ci-llm-integration)** - Access to build failures, test results, and deployment status from your CI/CD processes
- **[Enhanced Code Generation](https://nx.dev/blog/nx-generators-ai-integration)** - AI-powered generator suggestions and custom scaffolding with intelligent defaults
- **Cross-project Impact Analysis** - Understanding the implications of changes across your entire monorepo
- **Autonomous Error Debugging** - AI independently accesses context to help fix development issues

## Configure CI to Leverage AI Capabilities

Nx also integrates AI directly into your CI runs to automatically detect failed tasks, analyze the errors, and propose fixes that can be reviewed and applied directly to your PR.

Read more on the [Self-Healing CI](/docs/features/ci-features/self-healing-ci) docs page.

## Learn More about Nx and AI

Learn more about [why Nx and AI work so well together](https://nx.dev/blog/nx-and-ai-why-they-work-together).
